<template>
	<view>
		<view class="text-center">
			<image class="cu-avatar xl round margin-top" src="/src/static/logo.png" mode=""></image>
			<view class="margin text-xl">
				登录账号
			</view>
			<view class="">
				在此处登录您的账户
			</view>
		</view>
		<view class="padding-lr margin-lr">
			<view class="margin-tb">
				账号
			</view>
			<custom-input v-model="username" holder="请输入账号">
				<text class="iconfont icon-wode"></text>
			</custom-input>
		</view>
		<view class="padding-lr margin-lr">
			<view class="margin-tb">
				密码
			</view>
			<custom-input v-model="password" holder="请输入密码" type="password">
				<text class="iconfont icon-mima"></text>
			</custom-input>
		</view>
		<view class="padding margin-top">
			<button class="cu-btn bg-orange block" @click="handelLogin">登录</button>
			<button class="cu-btn bg-gray block margin-tb" @click="handelRegister">注册</button>
		</view>
	</view>
</template>

<script setup lang="ts">
import type{ Ref } from 'vue';
import { ref} from 'vue';
import {useStore} from 'vuex'
import {userRegister} from '@/api/user'
const username:Ref<string> = ref('')
const password:Ref<string> = ref('')
const store = useStore()
const handelLogin = ()=>{
	store.dispatch('user/loginAction',{
		"username":username.value,
		"password":password.value
	})
}
const handelRegister = ()=>{
	uni.navigateTo({
		url:'/pages/login/register'
	})
}

</script>

<style lang="scss">
page{
	background-color: white;
	image{
		width: 200upx;
		height: 200upx;
	}
}
</style>
